using System;
using System.Web.Mvc;
using Camdug.Web.Services;

namespace Camdug.Web.Controllers
{
    public class RegisterController : Controller
    {
        private readonly IRegisteredMembersRepository registeredMembersRepository;

        public RegisterController(IRegisteredMembersRepository registeredMembersRepository)
        {
            this.registeredMembersRepository = registeredMembersRepository;
        }

        public ActionResult Index()
        {
            return View();
        }

        public bool Register(string username, string password)
        {
            if(String.IsNullOrEmpty(password))
                return false;

            return registeredMembersRepository.SaveUser(username, password);
        }
    }
}
